# Maintainer: David Runge <dvzrv@archlinux.org>

_name=svglib
pkgname=python-svglib
pkgver=1.5.1
pkgrel=2
pkgdesc="Read SVG files and convert them to other formats"
arch=(any)
url="https://github.com/deeplook/svglib"
license=(LGPL3)
depends=(python-lxml python-reportlab python-tinycss2 python-cssselect2)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pillow python-pytest)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('5f0f21e1be59b3d6e4e9f58893f35e4cd268c25cf5d422487c7f58723286c114206d0d6f212bf0e1e52d7b192de0ed870e52a5d1423e90ddd962e00f41e5048d')
b2sums=('06f3b04b750b31b9238ada9f40659b1ab0999a645c111524d750eeadc5f9e0a5c9f522f98f9066ec0042859ad8c15c6bcd90bb2501590b6f2d1cf1946f515c50')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:$PYTHONPATH"
  # disable tests that need remote resources
  pytest -vv -k "not TestWikipediaSymbols and not TestWikipediaFlags"
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {CHANGELOG,CONTRIBUTORS,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
}
